import axios from 'axios';

const baseUrl = 'http://localhost:3000/products';

export async function fetchProducts() {
    const response = await axios.get(baseUrl);
    return response;
}

export async function addProduct(product) {
    const response = await axios.post(baseUrl, product);
    return response;
}

export async function updateProduct(productId, updatedProduct) {
    const response = await axios.put(`${baseUrl}/${productId}`, updatedProduct);
    return response;
}

export async function deleteProduct(productId) {
    const response = await axios.delete(`${baseUrl}/${productId}`);
    return response;
}